package edu.hitsz.application;

import edu.hitsz.basic.AbstractFlyingObject;

import javax.swing.*;
import java.awt.*;

public class Explode extends AbstractFlyingObject{
    //爆炸位置
    private int locationX;
    private int locationY;

    static  Image[] images = new Image[16];
    //爆炸次数
    private int explodeCount = 0;

    static {
        for (int i = 0;i < 16;i++){
            images[i] = Toolkit.getDefaultToolkit().getImage("src/images/explode/e" + (i + 1) + ".gif");
        }
    }

    public Explode(int locationX, int locationY) {
        this.locationX = locationX;
        this.locationY = locationY;
    }

    public void paint(Graphics g){
        for (int i = 0;i < 16;i++){
            g.drawImage(images[i],-100,-100,null);
        }
        if(explodeCount < 16){
            g.drawImage(images[explodeCount],locationX,locationY,null);
            explodeCount++;
        }
    }

    public int getExplodeCount() {
        return explodeCount;
    }
}
